Rat Sightings

The Rat Sightings data is from NYC OpenData. This dataset includes information for all rat-related 311 service requests from 2010 to the present. We stored the data [locally? G drive?] since it was too large to upload to github. To clean the data, we changed the created_date variable from MM/DD/YYYY HH:MM into separate “month,” “day,” and “year” variables; made the year variable numeric; corrected capitalization for address_type, city, and borough; recoded values for clarity; and filtered to remove observations in unspecified boroughs. After cleaning the data, our key variables are:

  • month: month of rat sighting service request
  • day: day of rat sighting service request
  • year: year of rat sighting service request
  • location_type: location type of rat sighting
  • address_type: address type of rat sighting
  • city: city of rat sighting
  • borough: borough of rat sighting
  • latitude: geo based latitude of incident location
  • longitude: geo based longitude of incident location

To better understand trends in rat sightings in NYC, we conducted some exploratory analysis using data visualization.

First, we plotted rat sightings over time. Next, we explored the distribution of rat sighting frequency by borough and over time. Then, we explored top location types of rat sightings (i.e. apartment versus street versus park). Finally, we mapped rat sightings across the city using a density map.

Sightings over time

New York City

First, we wanted to get a sense of rat sighting trends over time. The following line graph shows how the number of sightings have changed over time:

Based on the plot, we see that rat sightings have generally increased since 2010, except for a brief decline between 2017 and 2020. Since 2020, the number of rat sightings in NYC has sharply increased.

By Borough

With a better understanding of general trends, we wanted to explore rat sighting trends over time by borough. The following line graph shows how the number of sightings has changed over time, color-coded by borough:

Based on the plot, we see that the Bronx, Brooklyn, Manhattan, and Queens generally follow similar trends as NYC overall. Of these boroughs, the Bronx deviates the most, showing a decrease in rat sightings since 2021. Staten Island is different from all other boroughs and NYC overall. Rat sightings there have remained steady, and low, since 2010.

Sightings Frequency

By Borough

The following bar graph shows the distribution of rat sighting frequency by borough between 2010 and 2022:

The plot shows that Brooklyn has the most rat sightings overall, with more than 70,000 sightings reported. Staten Island has the least number of sightings, with less than 10,000 sightings reported.

By Borough and Year

This bar graph shows the distribution of rat sighting frequency by borough for each year with available data.

Since 2010, the overall frequency ranking of each borough has remained the same: from least to greatest, Staten Island, Queens, The Bronx, Manhattan, and Brooklyn. Since 2020, sightings have increased most significantly in Manhattan and Brooklyn. With the Bronx’s decrease since 2021, the Bronx and Queens are nearly tied so far in 2022.

Top Location Types

New York City

The bar graph shows the distribution of rat sightings frequency by location type.

Overall, 3+ family apartment buildings had the highest number of sightings followed by 1-2 family dwellings. Of the top 10 location types, parking lots/garages had the lowest.

By Borough

The following bar graph shows the distribution of the number of sightings by top sighting locations by borough:

In all boroughs except Queens and Staten Island, the highest number of sightings were in 3+ family apartment buildings. In Queens and Staten Island, the highest number of sightings were in 1-2 family dwellings.

Mapping

Finally, we mapped rat sightings across NYC by density:

As expected, we see rat sightings all over the city, with more rat sightings occurring in higher-density areas in the high-sighting boroughs identified in our previous plots.